<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\user_center\behavior\user\change_new_mobile_before;

/**
 * 检测手机号码绑定
 * @package app\user_center\behavior\user\change_new_mobile_before
 * @author shiqiang
 */
class checkMobileBind{
    /**
     * 执行行为 run方法是Behavior唯一的接口
     * @access public
     * @return void
     */
    public function run($params){
		$uid 		= $params['uid'];
		$mobile 	= $params['mobile'];
		
		$result = model('UcMemberMobile', 'model\user') -> getDataByMobile($mobile);
		if($result['code'] > 0){
			$result_uid = $result['data'] -> uid;
			if($uid == $result_uid){
				return array_out(-1001, '新手机号码不能与原手机号码相同');
			}else{
				return array_out(-1001, '手机号码已被其他用户绑定');
			}
		}
    }
}
